package sit.wetsion.galio.common.constant;

/**
 * 认证常量
 *
 * @author weixin
 * @version 1.0
 * @CLassName AuthSecurityConstant
 * @date 2019/3/6 11:39 AM
 */
public interface AuthSecurityConstant {
    /**
     * 角色前缀
     */
    String ROLE = "ROLE_";
    /**
     * rms前缀
     */
    String PROJECT_PREFIX = "rms_";

    /**
     * oauth 前缀
     */
    String OAUTH_PREFIX = "oauth:";

    /**
     * 获取token URL
     */
    String OAUTH_TOKEN_URL = "/oauth/token";

    /**
     * grant_type
     */
    String REFRESH_TOKEN = "refresh_token";

    /**
     * oauth 客户端信息，用于redis的key
     */
    String CLIENT_DETAILS_KEY = PROJECT_PREFIX + OAUTH_PREFIX + "client:details";

    String CLIENT_FIELDS = "id as client_id, client_secret, resource_ids, scope, "
            + "authorized_grant_types, url as web_server_redirect_uri, authorities, access_token_validity, "
            + "refresh_token_validity, additional_information, autoapprove";

    /**
     * JdbcClientDetailsService 查询语句
     */
    String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS
            + " from sys_platform";

    /**
     * 默认的查询语句
     */
    String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by id";

    /**
     * 按条件id(当作client_id)查询
     */
    String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where id = ?";

}
